package leetcode.hash;

public class Test242 {
    public boolean isAnagram(String s, String t) {
        byte[] a = new byte[26];
        byte[] b = new byte[26];
        char[] sChar = s.toCharArray();
        for (char c : sChar) {
            int index = (byte) c - 97;
            a[index]++;
        }
        char[] tChar = t.toCharArray();
        for (char c : tChar) {
            int index = (byte) c - 97;
            b[index]++;
        }
        for (int i = 0; i < a.length; i++) {
            if (a[i] != b[i]){
                return false;
            }
        }
        return true;
    }
}
